#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> vvi;
        vvi.resize(numRows);
        int number[30] = { 1 };
        vvi[0].resize(1, 0);
        vvi[0][0] = 1;

        for (int i = 1; i < numRows; ++i)
        {
            vvi[i].resize(i + 1);
            for (int j = i; j >= 1; --j)
            {
                number[j] = number[j] + number[j - 1];
            }
            for (int j = 0; j <= i; ++j)
            {
                vvi[i][j] = number[j];
            }
        }
        return vvi;
    }
};

int main()
{
    Solution s;
    vector<vector<int>> vvi = s.generate(5);
    for (int i = 0; i < 5; ++i)
    {
        for (int j = 0; j <= i; ++j)
            cout << vvi[i][j] << ' ';
        cout << endl;
    }
    return 0;
}